<?php

namespace app\common\validate;

use think\Validate;

class Serve  extends Validate
{
  /**
   * 验证规则
   */
  protected $rule = [
    'serve_name'     => 'require',
    'serve_image'    => 'require',
    'serve_duration' => 'require|number',
    'serve_price'    => 'require',
    'serve_cid'      => 'require|number',
    //    'store_id'       => 'require|number',
    'serve_details'  => 'require'
  ];

  /**
   * 字段描述
   */
  protected $field = [];

  /**
   * 提示消息
   */
  protected $message = [
    'serve_name.require'     => '服务名称不能为空',
    'serve_image.require'    => '服务图片不能为空',
    'serve_duration.require' => '服务时长不能为空',
    'serve_duration.number'  => '服务时长为数字',
    'serve_price.require'    => '服务价格不能为空',
    'serve_cid.require'      => '服务类型不能为空',
    'serve_cid.number'       => '服务分类错误',
//            'store_id.require'       => '所属店铺不能为空',
    'serve_details.require'  => '服务介绍不能为空'
  ];

  /**
   * 验证场景
   */
  protected $scene = [];

  public function __construct(array $rules = [], $message = [], $field = [])
  {
    $this->field = [
      'serve_name'     => __('服务名称'),
      'serve_image'    => __('服务图片'),
      'serve_duration' => __('服务时长'),
      'serve_price'    => __('服务价格'),
      //    'serve_cid'      => __('服务类型'),
//      'store_id'       => __('所属店铺'),
      'serve_details'  => __('服务介绍')
    ];
    parent::__construct($rules, $message, $field);
  }
}